Everything Totally Explained


Ask & we'll explain, totally!
Turtle graphics
Totally Explained


  NEW! All the latest news in the worlds of computer gaming, entertainment, the environment,  
finance, health, politics, science, stocks & shares, technology and much, much, more.  


View this entry using RSS

Everything about Turtle Graphics totally explained

Turtle graphics is a term in computer graphics for a method of programming vector graphics using a relative cursor (the "turtle") upon a Cartesian plane. Turtle graphics is a key feature of the Logo programming language.

Overview

The turtle has three attributes:
  1. a position
  2. an orientation
  3. a pen, itself having attributes such as color, width, and up versus down. The turtle moves with commands that are relative to its own position, such as "move forward 10 spaces" and "turn left 90 degrees". The pen carried by the turtle can also be controlled, by enabling it, setting its color, or setting its width. A student could understand (and predict and reason about) the turtle's motion by imagining what they'd do if they were the turtle. Seymour Papert called this "body syntonic" reasoning.
From these building blocks one can build more complex shapes like squares, triangles, circles and other composite figures. Combined with control flow, procedures, and recursion, the idea of turtle graphics is also useful in a Lindenmayer system for generating fractals. Turtle geometry is also sometimes used in graphics environments as an alternative to a strictly coordinate-addressed graphics system.

History

Turtle graphics were added to the Logo programming language by Seymour Papert in the late 60s to support Papert's version of the turtle robot, a simple robot controlled from the user's workstation that's designed to carry out the drawing functions assigned to it using a small retractable pen set into or attached to the robot's body. Turtle geometry works somewhat differently from (x,y) addressed Cartesian geometry, being primarily vector-based (for example relative direction and distance from a starting point) in comparison to coordinate-addressed systems such as PostScript. As a practical matter, the use of turtle geometry instead of a more traditional model mimics the actual movement logic of the turtle robot. The turtle is traditionally and most often represented pictorially either as a triangle or a turtle icon (though it can be represented by any icon).
   Papert's daughter, Artemis, has been using turtle graphics to explore the relationship between art and algorithm.

Example

The following actions generate the figure to the right, assuming a turtle initially pointed towards the top of the page and the pen is down.
  • repeat four times:
    • turn right 90 degrees
    • move forward 100 steps
  • then move forward 100 steps again

    Extension to Three Dimensions

    The ideas behind turtle graphics can be extended to include three-dimensional space. This is achieved by using one of several different coordinate models. If the turtle operates in cylindrical coordinates, then it has a location and a heading within its plane, and its plane may be rotated around the vertical axis. This often manifests itself as the turtle having two different heading angles, one within the plane and the other determining the plane's angle. Usually changing the plane's angle doesn't move the turtle.
       Other coordinate models may also be used. For a more complete discussion of three-dimensional turtle coordinate systems and some examples of each, see Terrapin turtle graphics.

    Further Information

    Get more info on 'Turtle Graphics'.


    External Link Exchanges

    Do you know how hard it is to get a link from a large encyclopaedia? Well we're different and will prove it. To get a link from us just add the following HTML to your site on a relevant page:

      <a href="http://turtle_graphics.totallyexplained.com">Turtle graphics Totally Explained</a>

    Then simply click through this link from your web page. Our crawlers will verify your link, extract the title of your web page and instantly add a link back to it. If you like you can remove the words Totally Explained and embed the link in article text.
       As long as your link remains in place, we'll keep our link to you right here. Please play fair - our crawlers are watching. Your site must be closely related to this one's topic. Any kind of spamming, dubious practises or removing the link will result in your link from us being dropped and, potentially, your whole site being banned.



  • Copyright © 2007-8 totallyexplained.com | Licensed under the GNU Free Documentation License | Site Map
    This article contains text from the Wikipedia article Turtle graphics (History) and is released under the GFDL | RSS Version